package com.code.thread.a1b2c3;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.LockSupport;

public class A1LockSupport {

    static  Thread t1, t2 ;
    public static void main(String[] args) {

        char[] nums = "12345".toCharArray();
        char[] zimu = "ABCDE".toCharArray();
        t1 = new Thread(()->{
            for (char c : nums) {
                System.out.print(c);
                LockSupport.unpark(t2);
                LockSupport.park();
            }
        });

       t2 =  new Thread(()->{
           for (char c : zimu) {
               LockSupport.park();
               System.out.print(c);
               LockSupport.unpark(t1);
           }
        });

       t1.start();
       t2.start();
    }

}
